package com.springboot.blog.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.springboot.blog.beans.AdminUser;
import com.springboot.blog.beans.Blog;
import com.springboot.blog.beans.User;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface UserDao extends BaseMapper<User> {

    /**
     * 根据用户名查找用户
     * @param username
     * @return
     * @throws Exception
     */
    public User queryByUsername(String username)throws Exception;

    /**
     * 根据用户名和电话号码查询用户信息
     */
    public User findUserAndPhone(String username,String phone);
    /**
     * 找回用户密码
     */
    public Boolean updateUser(String username, String password,String pwdsalt);

    //分页查询
    List<User> queryUserForItems(@Param(value = "begin") int begin, @Param(value = "pageSize") Integer pageSize);

    //根据用户名修改个人信息
    public int updateInfo(User user);

    //根据用户名修改密码
    public int updatePass(String username,String password,String pwdsalt);

    //查询所有用户（已审核的）
    List<User> findAllUser();

    //根据用户名修改openid等
    int updateAppid(String userName,String openid,Integer available);

    //根据openid查找用户信息
    User selectUserByOpenid(String openid);

    //根据openid统计数量
    int countByOpenid(String openid);

}
